//
//  NSError+NetworkError.m
//  BZBaseNetWorkSDK
//
//  Created by quheng on 2017/9/26.
//  Copyright © 2017年 瞿衡. All rights reserved.
//

#import "NSError+NetworkError.h"


#define  errorDomain @"zzf.bz.ym"

const static NSString *sessionIDErrorMessage     = @"sessionID is nil!!!";
const static NSString *requestParamErrorMessage  = @"request param is nil!!!";
const static NSString *requestOtherErrorMessage  = @"request other error!!!";
const static NSString *requestMethodErrorMessage = @"request method is nil!!!";

const static NSInteger bzErrorCode = -666;


@implementation NSError (NetworkError)



+ (NSError *)errorWithType:(BZRequestError)requestError{

    
    NSError *error = nil;
    if (requestError == BZRequestSessionIdError) {//sessionId为空error
        
        error = [NSError errorWithDomain:errorDomain code:bzErrorCode userInfo:@{NSLocalizedDescriptionKey:sessionIDErrorMessage}];
        
    }else if (requestError == BZRequestParamerError){//paramer 为空
        
        error = [NSError errorWithDomain:errorDomain code:bzErrorCode userInfo:@{NSLocalizedDescriptionKey:requestParamErrorMessage}];
    
    }else if (requestError == BZRequestMethodError){//请求方法为空
    
        error = [NSError errorWithDomain:errorDomain code:bzErrorCode userInfo:@{NSLocalizedDescriptionKey:requestMethodErrorMessage}];
    
    }
    
    return nil;
    
}

@end
